package lbim.client.ui;

import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

/**
 * @author tharindu
 */
public class MainMidlet extends MIDlet {
    //Application main object
    public static MainMidlet midlet_;

    public static MainUI ui_;

    public void startApp() {
        midlet_ = this;
        ui_ = new MainUI();
        ui_.setView(MainUI.SCR_SPLASH); // [SCREEN]
        try {
            Thread.sleep(1500);
        } catch (InterruptedException ex) {

        }
        ui_.setView(MainUI.SCR_MAIN); // [SCREEN]
    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) throws MIDletStateChangeException {
        System.out.println("Calledlll");
        System.gc();
    }

    public static MainMidlet getInstance() {
        return midlet_;
    }

    public Display getDisplay() {
        return Display.getDisplay(this);
    }

    public void setDisplay(Displayable d) {
        Display.getDisplay(this).setCurrent(d);
    }
}
